package com.ml.mall.mapper.coupon;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ml.mall.bean.vo.coupon.CupponDetailVO;
import com.ml.mall.entity.coupon.SysCouponRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface SysCouponRecordMapper extends BaseMapper<SysCouponRecord> {
    @Select("select count(id) from sys_coupon_record where company_id = #{companyId} and coupon_code=#{coupponCode}")
    int selectUseNumByComIdAndCode(@Param("companyId") Long companyId, @Param("coupponCode") String coupponCode);

    List<CupponDetailVO> cupponDetailVOList(@Param("oid") Long oid,@Param("supplierId") Long supplierId);

    //查询卖家优惠券记录
    @Select("select * from sys_coupon_record where supplier_id = #{supplierId} and oid = #{oid}")
    List<SysCouponRecord> selectSupplierOrderCoupon(@Param("supplierId") Long supplierId,@Param("oid") Long oid);
}